fix: avoid Suggests-only packages in tests and examples#449
Merged
Conversation
The CRLF test calls includeMarkdown(), which requires the Suggests-only markdown package. Skip the test in environments where it isn't available (e.g. the depends-only GHA check).
3891cfe to
c994806
Compare
The depends-only R CMD check installs only Depends/Imports, so the
example errored with 'no package called withr'. Wrap the
withr::with_options() call in requireNamespace("withr") so the
example runs when the Suggested package is available and is skipped
otherwise.
c994806 to
4093ff1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix two failures in the depends-only R CMD check, where only
Depends/Importspackages are installed:tests/testthat/test-print.R: skip theCRLF is properly handledtest when the Suggests-onlymarkdownpackage isn't installed (the test callsincludeMarkdown(), which requires it).R/tags.R: guard thewithr::with_options()call in thetagFunction()example withif (requireNamespace("withr", quietly = TRUE))so the example runs whenwithris available and is skipped otherwise.Also regenerates the man pages with roxygen2 8.0.0 (replacing
RoxygenNotewithConfig/roxygen2/versioninDESCRIPTION).Test plan
R-CMD-check / check-depends-onlypasses